﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.HomeServer.Controls;
using Umbrella.Whs.SharePoint;
using Umbrella.Whs.WhsAddin.Wizards.SharePointInstallation;

namespace Umbrella.Whs.WhsAddin.SettingsControls
{
    public partial class SharePointNotInstalled : SettingsControlBase
    {
        public SharePointNotInstalled(UmbrellaSettingsTab tab)
            : base(tab)
        {
            if (_log.IsDebugEnabled)
                _log.Debug("Initialization start");

            try
            {
                InitializeComponent();

                // done
                if (_log.IsDebugEnabled)
                    _log.Debug("Initialization done");
            }
            catch (Exception e)
            {
                _log.Fatal("Failed to initialize", e);

                throw;
            }
        }

        private void qButton1_Click(object sender, EventArgs e)
        {
            try
            {
	            var wiz = new SharePointInstallationWizard();
	
	            wiz.Run();

                _tab.ResetState();
            }
            catch (Exception ex)
            {
                _log.Error("Failed to run SharePoint installation wizard", ex);
            }
        }
    }
}
